using System;
using System.Collections.Generic;
using System.Text;

namespace cb0tServer
{
    class SCASPool
    {
        public static SCASObject[] scas_items = new SCASObject[20];

        public static void Broadcast(byte[] packet)
        {
            foreach (SCASObject scas in scas_items)
                if (scas.IsSet())
                    if (scas.logged_in)
                        scas.SendOutboundPacket(packet);
        }

        public static int GetNextAvailableSocketId()
        {
            for (int x = 0; x < scas_items.Length; x++)
            {
                if (!scas_items[x].IsSet())
                {
                    return x;
                }
            }

            return -1;
        }

        public static void KillSessions()
        {
            foreach (SCASObject s in scas_items)
                if (s.IsSet())
                    s.Disconnect();
        }
    }
}
